<?php

namespace app\common\model;

use think\Model;

class UserApplyCash extends Model
{

    /**
     * 根据id获取提现信息
     * @param $id
     * @return array|false|\PDOStatement|string|Model
     */
    static function get_cash_by_id($id)
    {
        $s = new self();
        $data = $s->where(["id"=>$id])->find();
        return $data;
    }

    /**
     * 用户申请提现和用户信息
     */
    static function cash_list($param=[],$cond=[])
    {
        #筛选提现审核状态
        if (isset($param['status'])&& $param['status']!="") {
            $cond['status'] = $param['status'];
        }
        #搜索订单号,用户名和电话号
        if (isset($param['search_']) && !empty($param['search_'])) {
            $search_ = $param['search_'];
            $cond["user_name|telephone"] = ["LIKE", "%$search_%"];
        }
        $s = new self();
        $data = $s
            ->field('shop_user_apply_cash.*,shop_users.user_name,shop_users.telephone')
            ->join('shop_users','shop_user_apply_cash.user_id=shop_users.id')
            ->where($cond)
            ->paginate(30,false,['query'=>request()->param()]);
        return $data;
    }

}
